package com.atguigu.yygh.hosp.controller;

import com.atguigu.yygh.common.result.Result;
import com.atguigu.yygh.hosp.service.ScheduleService;
import com.atguigu.yygh.model.hosp.Schedule;
import com.atguigu.yygh.param.hosp.getScheduleDetailParam;
import com.atguigu.yygh.param.page.ScheduleGetPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author WGH
 */
@RestController
@RequestMapping("/admin/hosp/schedule")
@Api(value = "ScheduleController",tags = "医院排班管理")
public class ScheduleController {

    @Resource
    private ScheduleService scheduleService;

    /**
     * 根据医院编号 和 科室编号 ，查询排班规则数据
     * @param param
     * @return
     */
    @ApiOperation(value ="查询排班规则数据")
    @PostMapping("/getScheduleRule")
    public Result getScheduleRule(@RequestBody ScheduleGetPage param) {
        Map<String,Object> map = scheduleService.getRuleSchedule(param);
        return new Result(map);
    }

    /**
     * 根据医院编号 和 科室编号 以及排班日期，查询排班信息
     * @param param
     * @return
     */
    @ApiOperation(value ="查询排班详细信息")
    @PostMapping("/getScheduleDetail")
    public Result getScheduleDetail(@RequestBody getScheduleDetailParam param) {
        List<Schedule> ScheduleDetail = scheduleService.getScheduleDetail(param);
        return new Result(ScheduleDetail);
    }


}
